function gui_exception(exception, debug)

if(nargin < 2)
    debug = false;
end

if(debug)
    getReport(exception, 'extended', 'hyperlinks', 'on')
    errordlg({exception.message,'See console for more details'},...
        'Error','modal');
else
    errordlg({exception.message,'',...
        [exception.stack(1).file ...
        ' line ' num2str(exception.stack(1).line)]},...
        'Error', 'modal')
end